package com.itheima.dao;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.itheima.domain.Customer;
@Repository("customerDao")
public class CustomerDaoImpl extends HibernateDaoSupport implements CustomerDao {

	@Resource(name="sessionFactory")
	public void setSf(SessionFactory factory){
		super.setSessionFactory(factory);
	}
	
	@Override
	public List<Customer> findCustomers() {
		List<Customer> cts = (List<Customer>) this.getHibernateTemplate().find("from Customer");
		return cts;
	}

}
